/**
 * 
 */
package se.cirrus.base;

/**
 * @author Winquman
 *
 */
public class CirrusVersion implements Comparable<CirrusVersion> {

	public final int major;
	public final int minor;
	public final int revision;
	
	/**
	 * 
	 */
	public CirrusVersion(int major, int minor, int revision) {
		this.major = major;
		this.minor = minor;
		this.revision = revision;
	}


	@Override
	public int compareTo(CirrusVersion arg0) {
		int i = 0;
		
		i = major - arg0.major;
		if(i != 0)
			return i;
		
		i = minor - arg0.minor;
		if(i != 0)
			return i;
		
		return revision - arg0.revision;
	}
	
	/**
	 * Compatable if both major and minor matches.
	 * Also add any exceptions to this rule here.
	 * @param c
	 * @return
	 */
	public boolean compatableWith(CirrusVersion c) {
		return ((major == c.major) && (minor == c.minor));
	}

}
